﻿ <TR><TD>
<A onclick=doForeCol()  href="#">
<IMG  src="/ed_color_fg.gif" border=0>
</A>
 </TD></TR>
 
<TR><TD>
<DIV class=richtext id=msg_div contentEditable=true  align=left></DIV>
<INPUT type=hidden value=" name=msg> </INPUT> 
</TD></TR>
 
<INPUT onclick=getRichTextValue() type=submit value=" 更新 "> 
 
javascript：
function doForeCol(){
 newcolor = showModalDialog("../images/select_color.html",
 newcolor , "resizable: no; help: no; status: no; scroll: no;");
 msg_div[currentdiv].focus();
 if(newcolor != null){
        document.execCommand("ForeColor",true,newcolor);
    }
}
 
function getRichTextValue(){
 if(document.all("msg_div")==null)
        return;
    var count=document.all("msg_div").length;
    if(count==undefined){
        document.all("msg").value=document.all("msg_div").innerHTML;
    }else{
     for( i=0;i<count;i++){
         document.all("msg")[i].value=document.all("msg_div")[i].innerHTML;
     }
    }
}
 
css:
.richtext{
 border:1px #7a96df solid;
 height:45px; 
 width:441px; 
 padding:2px;
 overflow-y:scroll;
 overflow-x:hidden;
 text-align:left; 
} 